<?php

namespace app\admin\controller;

use app\common\model\Member;
use app\common\model\MemberPackages as MemberPackagesModel;
use app\common\model\Packages;
use app\common\model\UcenterMember;
use think\Db;
use app\common\api\controller\Bonus;
use app\common\api\controller\User as UserApi;
use app\common\api\controller\Error;
use think\Request;
use think\Validate;


class MemberPackages extends Home
{
    private static $packagesModel;
    private static $status_arr = [
        0 => '已结束',
        1 => '进行中',
    ];

    public function __construct(Request $request = null)
    {
        parent::__construct($request);

        self::$packagesModel = new MemberPackagesModel();
    }

    /**
     * Notes:消费包列表
     * User: Administrator
     * Date: 2023/9/5
     * Time: 19:19
     * @return mixed
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function lists()
    {
        $uid = input('uid');

        $map['uid'] = $uid;
        $list = self::$packagesModel->where($map)->order('id desc')->select();

        foreach ($list as $v) {
            $v->status_name = self::$status_arr[$v->status];
        }

        $this->assign('_list', $list);
        $this->assign('title', '消费包列表');
        return $this->fetch();
    }

}